import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { UserOutline, DeleteTwoTone, FilePdfTwoTone } from '@ant-design/icons-angular/icons';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzDividerModule } from 'ng-zorro-antd/divider';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzTableModule } from 'ng-zorro-antd/table';
import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzGridModule } from 'ng-zorro-antd/grid';
import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { NzMessageModule } from 'ng-zorro-antd/message';
import { NzCardModule } from 'ng-zorro-antd/card';
import { NzCollapseModule } from 'ng-zorro-antd/collapse';
import { NzTreeModule } from 'ng-zorro-antd/tree';
import { NzListModule } from 'ng-zorro-antd/list';

import { WidgetPanelComponent } from './components/widget-panel/widget-panel.component';
import { WidgetAddComponent } from './components/widget-add/widget-add.component';
import { PdfDialogComponent } from './components/pdf-dialog/pdf-dialog.component';
import { DialogService } from './services/dialog.service';
import { SafeUrlPipe } from './pipes/safe.pipe';


// 引入zorro图标
const icons = [
  UserOutline,
  DeleteTwoTone,
  FilePdfTwoTone
];

// angular模块
const ANGULARMODULE = [
  CommonModule,
  FormsModule,
  RouterModule,
  ReactiveFormsModule
];

// ng-zorro模块
const NGZORROMODULE = [
  NzIconModule.forRoot(icons),
  NzLayoutModule,
  NzButtonModule,
  NzDividerModule,
  NzMenuModule,
  NzTableModule,
  NzBreadCrumbModule,
  NzFormModule,
  NzGridModule,
  NzSpaceModule,
  NzSelectModule,
  NzModalModule,
  NzRadioModule,
  NzDropDownModule,
  NzMessageModule,
  NzCardModule,
  NzCollapseModule,
  NzTreeModule,
  NzListModule
];

// 公共组件
const COMPONENTS = [
  WidgetPanelComponent,
  WidgetAddComponent,
  PdfDialogComponent,
];
// 公共服务
const SERVICES = [
  DialogService
];
// 公共管道
const PIPES = [
  SafeUrlPipe
];
// 公共指令
const DIRECTIVES = [];


@NgModule({
  imports: [
    ...ANGULARMODULE,
    ...NGZORROMODULE
  ],
  declarations: [
    ...COMPONENTS,
    ...DIRECTIVES,
    ...PIPES,
  ],
  providers: [...SERVICES],
  exports: [
    ...ANGULARMODULE,
    ...NGZORROMODULE,
    ...COMPONENTS,
    ...DIRECTIVES,
  ]
})
export class SharedModule { }
